

import 'package:flutter/material.dart';
import 'package:flutter_myshop/model/category.dart';

// 子分类状态管理
class ChildCategoryProvider with ChangeNotifier{

  // 现在应该展示的小分类列表
  List<SmallCategory> smallCategoryList=[];

  // 选中的大分类的ID
  String bigCategoryId;

  // 选中的小分类的ID
  String smallCategoryId;

  // 小分类现在选中的index
  int smallCategoryIndex = 0;

  void setSmallCategoryList(List<SmallCategory> list){
    smallCategoryList = list;
    notifyListeners();
  }

  void addSmallCategoryList(List<SmallCategory> list){
    smallCategoryList.addAll(list);
    notifyListeners();
  }

  void setSmallCategoryIndex(int index){
    smallCategoryIndex = index;
    notifyListeners();
  }

  void setSmallCategoryId(String id){
    smallCategoryId = id;
    notifyListeners();
  }
  
    void setBigCategoryId(String id){
    bigCategoryId = id;
    notifyListeners();
  }

}


